#if !defined(__APP_BUFFER_H__)
#define __APP_BUFFER_H__
#include "pthread.h"
#include "stdlib.h"
#include "../thirdpart/log/log.h"
#include "string.h"
#define MAX_BUFFER_SIZE (256-1)
typedef struct
{
    unsigned char *pBuffer;
    int nSize;
    int len;
} SubBuffer_t;

typedef struct
{
    SubBuffer_t *pSubBuffer[2];
    int readindex;
    int writeindex;
    pthread_mutex_t read_mutex;
    pthread_mutex_t write_mutex;

} Buffer;

Buffer *app_BufferInit(int nSize);

void app_BufferDestroy(Buffer *Buffer);

int app_BufferWrite(Buffer *pBuffer, char *buffer, int bufferSize);

int app_BufferRead(Buffer *pBuffer, char *buffer, int bufferSize);

#endif // __APP_BUFFER_H__
